package com.springboot.service.impl;

import com.springboot.mapper.StudentMapper;
import com.springboot.model.Student;
import com.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.beans.Transient;

@Service

public class StudentServiceImpl implements StudentService {

    @Autowired private StudentMapper studentMapper;
    @Transactional  //使用事务
    @Override
    public int updateStudentById(Student student) {
        //修改成功
        int i= studentMapper.updateByPrimaryKeySelective(student);

        //失败
        int a=10/0;
        return i;
    }
}
